/*
 * This file is part of aion-emu <aion-emu.com>.
 *
 *  aion-emu is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  aion-emu is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with aion-emu.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.aionemu.gameserver.model.gameobjects.stats;

import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.model.gameobjects.state.CreatureState;

/**
 * @author xavier
 * 
 */
public class NpcGameStats extends CreatureGameStats<Npc>
{
	float	currentRunSpeed	= 0f;

	public NpcGameStats(Npc owner)
	{
		super(owner);
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getMovementSpeed()
	 */
	@Override
	public Stat getMovementSpeed()
	{
		if (owner.isInState(CreatureState.FLYING) || owner.isInState(CreatureState.GLIDING))
			return getStat(StatEnum.FLY_SPEED, Math.round(owner.getObjectTemplate().getCreatureStatData().getMoveSpeedNormalRun()*1.3f*1000));
		else if (owner.isInState(CreatureState.COMBAT))
			getStat(StatEnum.SPEED, Math.round(owner.getObjectTemplate().getCreatureStatData().getMoveSpeedCombatRun()*1000));
		else if (owner.isInState(CreatureState.WALKING))
			return getStat(StatEnum.SPEED, Math.round(owner.getObjectTemplate().getCreatureStatData().getMoveSpeedNormalWalk()*1000));
		return
			getStat(StatEnum.SPEED, Math.round(owner.getObjectTemplate().getCreatureStatData().getMoveSpeedNormalRun()*1000));
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getMaxHP()
	 */
	@Override
	public Stat getMaxHP()
	{
		return getStat(StatEnum.MAXHP, owner.getObjectTemplate().getCreatureStatData().getHp());
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getMaxMP()
	 */
	@Override
	public Stat getMaxMP()
	{
		return getStat(StatEnum.MAXMP, owner.getObjectTemplate().getCreatureStatData().getMp());
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getAttackSpeed()
	 */
	@Override
	public Stat getAttackSpeed()
	{
		return getStat(StatEnum.ATTACK_SPEED, owner.getObjectTemplate().getCreatureStatData().getAttackDelay());
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getAttackRange()
	 */
	@Override
	public Stat getAttackRange()
	{
		return getStat(StatEnum.ATTACK_RANGE, Math.round(owner.getObjectTemplate().getCreatureStatData().getAttackRange()*1000));
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getPDef()
	 */
	@Override
	public Stat getPDef()
	{
		return getStat(StatEnum.PHYSICAL_DEFENSE, 0);
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getMagicalResist()
	 */
	@Override
	public Stat getMagicalResist()
	{
		return getStat(StatEnum.MAGICAL_RESIST, owner.getObjectTemplate().getCreatureStatData().getPAccuracy());
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getPower()
	 */
	@Override
	public Stat getPower()
	{
		return getStat(StatEnum.POWER, 100);
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getHealth()
	 */
	@Override
	public Stat getHealth()
	{
		return getStat(StatEnum.HEALTH, 100);
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getAccuracy()
	 */
	@Override
	public Stat getAccuracy()
	{
		return getStat(StatEnum.ACCURACY, 100);
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getAgility()
	 */
	@Override
	public Stat getAgility()
	{
		return getStat(StatEnum.AGILITY, 100);
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getKnowledge()
	 */
	@Override
	public Stat getKnowledge()
	{
		return getStat(StatEnum.KNOWLEDGE, 100);
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getWill()
	 */
	@Override
	public Stat getWill()
	{
		return getStat(StatEnum.WILL, 100);
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getMainHandPAttack()
	 */
	@Override
	public Stat getMainHandPAttack()
	{
		return getStat(StatEnum.PHYSICAL_ATTACK, owner.getObjectTemplate().getCreatureStatData().getPAttack());
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getMainHandCritical()
	 */
	@Override
	public Stat getMainHandPCritical()
	{
		//TODO
		//return getStat(StatEnum.PHYSICAL_CRITICAL, owner.getObjectTemplate().getCreatureStatData().getPCritical());
		return getStat(StatEnum.PHYSICAL_CRITICAL, 100);
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getPAccuracy()
	 */
	@Override
	public Stat getMainHandPAccuracy()
	{
		return getStat(StatEnum.PHYSICAL_ACCURACY, owner.getObjectTemplate().getCreatureStatData().getPAccuracy());
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getMagicalBoost()
	 */
	@Override
	public Stat getMagicalBoost()
	{
		//return getStat(StatEnum.BOOST_MAGICAL_SKILL, owner.getObjectTemplate().getCreatureStatData().getPAccuracy());
		return getStat(StatEnum.BOOST_MAGICAL_SKILL, 100);
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getMagicalAccuracy()
	 */
	@Override
	public Stat getMagicalAccuracy()
	{
		return getStat(StatEnum.MAGICAL_ACCURACY, owner.getObjectTemplate().getCreatureStatData().getPAccuracy());
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getMagicalCritical()
	 */
	@Override
	public Stat getMagicalCritical()
	{
		return getStat(StatEnum.MAGICAL_CRITICAL, 100);
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getEvasion()
	 */
	@Override
	public Stat getEvasion()
	{
		return getStat(StatEnum.EVASION, owner.getObjectTemplate().getCreatureStatData().getPAccuracy());
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getParry()
	 */
	@Override
	public Stat getParry()
	{
		return getStat(StatEnum.PARRY, 100);
	}

	/* (non-Javadoc)
	 * @see com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats#getBlock()
	 */
	@Override
	public Stat getBlock()
	{
		return getStat(StatEnum.BLOCK, 0);
	}
}